package com.panda.business.service;

import com.panda.business.mapper.WeChatContactMapper;
import com.panda.business.domain.WeChatContactInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional // 支持事务
public class WeChatContactService {

	@Autowired
	private WeChatContactMapper weChatContactMapper;

	public WeChatContactInfo findContactinfoByid(Integer id) {
		return weChatContactMapper.findContactinfoByid(id);
	}

	public WeChatContactInfo findContactinfoByfriendid(Integer cid, String wechatid, String friendid) {
		return weChatContactMapper.findContactinfoByfriendid(cid, wechatid, friendid);
	}

	public List<WeChatContactInfo> findContactinfoByWeChatId(Integer cid, String wechatid) {
		return weChatContactMapper.findContactinfoByWeChatId(cid, wechatid);
	}
	
	public List<WeChatContactInfo> findContactinfoByBid(Integer bid) {
		return weChatContactMapper.findContactinfoByBid(bid);
	}

	public void insert(WeChatContactInfo info) {
		weChatContactMapper.insert(info);
	}

	public void update(WeChatContactInfo info) {
		weChatContactMapper.update(info);
	}

	public void delete(Integer id) {
		WeChatContactInfo info = new WeChatContactInfo();
		info.setId(id);
		weChatContactMapper.delete(info);
	}

	public void updateFriendsTag(WeChatContactInfo info) {
		weChatContactMapper.updateFriendsTag(info);
	}

}
